package com.yanchangapp.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yanchangapp.R;
import com.yanchangapp.model.response.WaitDoneResponse;

import java.util.List;

/**
 * 待办的Adapter
 *
 * todo 背景色...
 */
public class WaitDoneAdapter extends BaseQuickAdapter<WaitDoneResponse.DataBean, BaseViewHolder> {
    private int[] colorsArray = {R.drawable.target_first,R.drawable.target_second,R.drawable.target_third,R.drawable.target_forth};
    public WaitDoneAdapter(int layoutResId, @Nullable List<WaitDoneResponse.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, WaitDoneResponse.DataBean item) {
        helper.setText(R.id.tvNum,String.valueOf(item.getCount()));
        helper.setText(R.id.tvTitle,item.getMatterName());
        helper.setBackgroundRes(R.id.viewBg,colorsArray[helper.getAdapterPosition()]);
        // 设置最后一条不可见...
        if (helper.getAdapterPosition() == mData.size()-1){
            helper.setVisible(R.id.borderLine,false);
        }
    }
}
